Skip to content

feat(theme): offer to build parent themes for build and watch - #284

Merged
dermatz merged 9 commits into
mainfrom
feature/build-parent-themes
Nov 11, 2026
Merged

dermatz merged 9 commits into
mainfrom
feature/build-parent-themes

Conversation

@dermatz

@dermatz dermatz commented Nov 11, 2026

Copy link
Copy Markdown
Member

What

theme:build and theme:watch never touched the parent of a child theme. They now offer to build the whole parent chain first.

  • New ThemeParentResolver returns buildable ancestors, topmost first (skips parents without path or builder).
  • Build: prompts when selected themes have parents that aren't selected; parents are built first and deduplicated.
  • Watch: prompts, builds the parents once, then watches only the selected theme.
  • New options --with-parents / --no-parents. Non-interactive environments (CI) default to not building parents, so existing behaviour is unchanged.
  • Docs and unit tests updated.

Notes

Not yet tested against a real child theme (e.g. videotronic → videor → base).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 11, 2026 13:22
@github-actions github-actions Bot added documentation Improvements or additions to documentation Feature Command labels Nov 11, 2026
@greptile-apps

greptile-apps Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 4/5

[Medium impact] The changes affect theme build and watch workflows.

The local-parent skip bug still needs fixing before merge.

Findings

  1. P1 Local parent themes are skipped ▶
Fix with agent prompt
### Issue 1
src/Service/ThemeParentResolver.php:undefined-100
`isVendorTheme` matches `/vendor/` anywhere in the full path. A local parent at `/magento-root/app/design/frontend/vendor/base` is therefore skipped, even with `--with-parents`. Its assets remain missing or stale while the child builds or starts watching.

Match the Composer directory under the Magento root instead, as `DependencyUpdater::isVendorTheme` already does.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Summary

Adds optional parent builds to theme:build and theme:watch.

  • Theme builds can include usable parents before the selected themes.
  • Theme watching can build usable parents once before watching the selected theme.

Reviews (4) · Last reviewed commit: "🐛 fix(theme): type inheritance chain wi..." · Reviewed by Greptile

Comment thread src/Console/Command/AbstractCommand.php Resolved

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The parent-selection flow can still prompt under --no-interaction and omit ancestors after a misspelled theme code is corrected, even with --with-parents.

2 open issues
What changed in this PR

Adds optional parent-theme builds to MageForge’s build and watch commands, so child themes can use freshly built ancestor assets.

Changes:

  • Resolves buildable ancestors in topmost-first order and deduplicates build selections.
  • Adds shared confirmation prompts and --with-parents / --no-parents options; watch builds parents once before watching only the child.
  • Updates command documentation and unit tests.
File Description
tests/​Unit/​Service/​ThemeParentResolverTest.php Tests ancestor ordering and missing-path handling.
tests/​Unit/​Console/​Command/​Theme/​WatchCommandTest.php Injects the parent resolver into existing tests.
tests/​Unit/​Console/​Command/​Theme/​BuildCommandTest.php Tests parent-first builds and explicit parent skipping.
src/​Service/​ThemeParentResolver.php Finds buildable ancestors with cycle protection.
src/​Console/​Command/​Theme/​WatchCommand.php Builds approved parents before starting the child watcher.
src/​Console/​Command/​Theme/​BuildCommand.php Expands build selections with ordered, deduplicated parents.
src/​Console/​Command/​AbstractCommand.php Shares parent options and confirmation logic.
docs/​commands_reference.md Documents parent-build options and behaviour.

Review effort: Balanced

Comment thread src/Console/Command/AbstractCommand.php Resolved
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 11, 2026 13:27
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Theme resolution can select admin ancestry for a frontend theme with the same code, causing the wrong parent chain to be built or watched, while confirmation-prompt behavior lacks interactive test coverage.

2 open issues
2 resolved since last review

Review effort: Balanced

Comment thread src/Service/ThemeParentResolver.php Resolved
Comment thread src/Console/Command/AbstractCommand.php Resolved
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 11, 2026 13:43
dermatz and others added 2 commits November 11, 2026 14:43
dermatz and others added 2 commits November 11, 2026 14:45

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Dependent children still build after parent failures, risking stale assets, and theme-code resolution can select ancestors from the wrong area.

No open issues 🎉

1 previously missed issue

In code that hasn't changed since last review

Medium severity Skip dependent theme builds when a parent build fails

src/​Console/​Command/​Theme/​BuildCommand.php:152

When an automatically added parent's build returns false, processBuildThemes() records the failure but still builds its child, which can consume missing or stale parent assets. Preserve the parent dependencies and skip dependent child builds after a parent fails in both verbose and non-verbose execution; unrelated selected themes can still proceed.

2 resolved since last review

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings November 11, 2026 13:47
Comment thread src/Service/ThemeParentResolver.php Resolved
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The new interactive confirmation remains untested, with coverage needed for acceptance, rejection, and non-interactive skipping under controlled terminal detection.

No open issues 🎉

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings November 11, 2026 13:51

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The new interactive confirmation remains untested for acceptance, rejection, non-interactive safeguards, and restoration of prompt environment variables.

No open issues 🎉

Review effort: Balanced

@dermatz
dermatz merged commit 4aaeb20 into main Nov 11, 2026
23 checks passed
@dermatz
dermatz deleted the feature/build-parent-themes branch November 11, 2026 13:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Command documentation Improvements or additions to documentation Feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants